home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1994-05-04 | 2.0 KB | 58 lines |
- > SwitchOff040
- Shutdown the computer without user interference.
- This is the rude method and the data in running Applikations
- will be lost.
- We simply set the IO-lines to switch off the computer.
- +4096
- "Error in ";
- I*IF "<Wimp$State>" = "commands" THEN Echo Automatic Shutdown started.
- switchoff
- switchoff
- We have a Desktop and some running Applikations.
- ok. We ignore them.
- But we can close open files and park disks aso.
- *Shutdown
- a =
- initSwitchOffRoutine
- code%=0
- 0,"**** SwitchOff **** Where is my code ??"
- "Hourglass_Start", 1
- Set both Aux1/2-lines
- A% = 3
- AuxSet
- tm% =
- + 1500
- .
- "Hourglass_Percentage", (tm%-
- )/100
- A% = 0
- AuxSet
- "Hourglass_Off"
- 'C; Initialise a Routine to set the Aux1/2-lines of the computer.
- (I; Returns the address of the routine. Call by
- with A% as Parameter.
- initSwitchOffRoutine
- LatAdr, pc, sp, link
- code% 128
- ,!pc = 15 : sp = 13 : link = 14
- P% = code%
- [ OPT 0
- ALIGN
- 0A.LatAdr EQUD &3350018 ; Adresse des Latches
- 26; (5) Setze die Aux1/2-Leitungen auf ein Bitmuster
- 3/; Entry R0 Bitmuster fuer Aux1/2 = Bit0,1
- ; Exit -
- .AuxSet
- 7( stmfd (sp)!,{r0,r1,link}
- 8O SWI "XOS_EnterOS" ; Reset nur im Supervisor moeglich.
- MOV r0, r0
- :F ldr r1, LatAdr ; lade Adresse des Latch B
- ;H and r0, r0, #3 ; nur Bits 0 und 1 zulassen.
- <M mov r0, r0, LSL #5 ; an die richtige Stelle bringen.
- =L orr r0, r0, #%00001000 ; Disc-Controller-Reset inaktiv.
- >F strb r0, [r1] ; speichere Date als Byte.
- ?P teqp pc, #0 ; Usermode setzen und Interruts ein.
- mov r0, r0
- A& ldmfd (sp)!,{r0,r1,pc}
- = AuxSet
-